package com.ibiaoke.boss.controller;

import com.ibiaoke.common.response.Res;
import com.ibiaoke.goods.entity.GoodsClass;
import com.ibiaoke.goods.service.GoodsClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * Created by Administrator on 2017/6/14.
 */
@Controller
public class GoodsClassController {
    @Autowired
    private GoodsClassService goodsClassService;

    /**
     * 添加商品分类
     * @param goodsClass
     * @return
     */
    @ResponseBody
    @RequestMapping("/saveGoodsClass")
    public Res saveGoodsClass(GoodsClass goodsClass){
        goodsClassService.saveGoodsClass(goodsClass);
        return Res.create();
    }

    /**
     * 修改分类
     * @param goodsClass
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateByGoodsClassId")
    public Res updateByGoodsClassId(GoodsClass goodsClass){
        goodsClassService.updateByGoodsClassId(goodsClass);
        return Res.create();
    }

    /**
     * 删除分类
     * @param goodsClassId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteByGoodsClassId")
    public Res deleteByGoodsClassId(Integer goodsClassId){
        goodsClassService.deleteByGoodsClassId(goodsClassId);
        return Res.create();
    }
}
